<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Shuts down a socket for receiving, sending, or both</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.socket-shutdown" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">socket_shutdown</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">socket_shutdown</span> &mdash; <span class="dc-title">Shuts down a socket for receiving, sending, or both</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.socket-shutdown-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>socket_shutdown</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$socket</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$how</code><span class="initializer"> = 2</span></span>
  ] ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   The <span class="function"><strong>socket_shutdown()</strong></span> function allows you to stop
   incoming, outgoing or all data (the default) from being sent through the
   <code class="parameter">socket</code>
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    The associated buffer, or buffers, may or may not be emptied.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.socket-shutdown-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">socket</code></dt>

     <dd>

      <p class="para">
       A valid socket resource created with <span class="function"><a href="socket_create.html" class="function">socket_create()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">how</code></dt>

     <dd>

      <p class="para">
       The value of <code class="parameter">how</code> can be one of the following:
       <table class="doctable table">
        <caption><strong>possible values for <code class="parameter">how</code></strong></caption>
        
         <tbody class="tbody">
          <tr>
           <td><em>0</em></td>
           <td>
            Shutdown socket reading
           </td>
          </tr>

          <tr>
           <td><em>1</em></td>
           <td>
            Shutdown socket writing
           </td>
          </tr>

          <tr>
           <td><em>2</em></td>
           <td>
            Shutdown socket reading and writing
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.socket-shutdown-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


</div></div></div></body></html>